package 文件内容操作;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * Created with IntelliJ IDEA.
 * Description:使用字符流读文件
 * User: lenovo
 * Date: 2022-10-16
 * Time: 20:25
 */
public class demo3 {
    public static void main(String[] args) throws IOException {
        Reader reader = new FileReader("./bbb.txt" );
        while(true){
            int ret = reader.read();
            if(ret == -1){//文件结尾
                break;
            }
            //将int转化为char:这里就转化成了字符->文本文件
            char ch = (char)ret;
            System.out.println(ch);
        }
        reader.close();

    }
}
